import Vue from 'vue'
import VueRouter from 'vue-router'

import Layout from '@/layout'

Vue.use(VueRouter)

const routes = [
  {
    path: '/login',
    name: 'Login',
    component: () => import('@/views/login'),
  },
  {
    path: '/',
    component: Layout,
    redirect: '/student/add',
    children: [
      {
        path: '/student/add',
        component: () => import('@/views/student/add'),
        name: 'StudentAdd',
        meta: { title: '学生添加' },
      },
      {
        path: '/student/edit',
        component: () => import('@/views/student/edit'),
        name: 'StudentEdit',
        meta: { title: '学生编辑' },
      },
    ],
  },
  {
    path: '/device',
    component: Layout,
    redirect: '/device/list',
    children: [
      {
        path: '/device/list',
        component: () => import('@/views/device/list'),
        name: 'DeviceList',
        meta: { title: '设备授权' },
      },
    ],
  },
]

const router = new VueRouter({
  routes,
})

export default router
